package com.fyzk.activity.share;

import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

import com.fyzk.base.BaseActivity;
import com.fyzk.data.preference.MySharedPreferences;
import com.fyzk.utils.DensityUtils;
import com.fyzk.utils.ZXingUtils;
import com.fyzk.view.TopTitleView;
import com.tyjc.lottery.R;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;

@ContentView(R.layout.activity_share_code)
public class ShareCodeActivity extends BaseActivity {
    @ViewInject(R.id.shareCodeUI_topView)
    private TopTitleView topView;
//    @ViewInject(R.id.shareCodeUI_tvShareUrl)
//    private TextView tvShareUrl;
//    @ViewInject(R.id.shareCodeUI_ivShareCode)
//    private ImageView ivShareCode;
    private String shareUrl = "";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initEvent();
//        WebView webView = (WebView) findViewById(R.id.webview);
//        webView.clearCache(true);
//        webView.clearHistory();
//        //加载网页链接
//        webView.loadUrl("http://vip.cqssc28.com:8008/invite?userno="+MySharedPreferences.getInstance().getUserNo());
        Intent intent1=new Intent(Intent.ACTION_VIEW);
        intent1.setData(Uri.parse("http://vips.kq111.cn/invite?userno="+MySharedPreferences.getInstance().getUserNo()));
        startActivity(intent1);
     //   initDate();
    }

    private void initEvent() {
        topView.setOnTitleClickListener(this);
    }

//    private void initDate() {
//        shareUrl = MySharedPreferences.getInstance().getQrUrl() + "&agencyNo=" + MySharedPreferences.getInstance().getUserNo();
//        tvShareUrl.setText(shareUrl);
//        Bitmap bitmap = ZXingUtils.createBitmap(shareUrl, DensityUtils.dip2px(this, 220), DensityUtils.dip2px(this, 220));
//        ivShareCode.setImageBitmap(bitmap);
//    }

    @Override
    public void onRightClick() {
        Intent intent = new Intent(this, MyInvitationActivity.class);
        startActivity(intent);
    }
}
